﻿using System;
using System.Linq;

namespace Smarly.Web.Helpers
{
	public static class DateTimeExtentions
	{
		static readonly TimeZoneInfo moscowTimeZone;
		static DateTimeExtentions()
		{
			moscowTimeZone = TimeZoneInfo.GetSystemTimeZones().Single(x => x.Id == "Russian Standard Time");
		}

		public static DateTime ToUserDate(this DateTime utc)
		{
			return TimeZoneInfo.ConvertTimeFromUtc(utc, moscowTimeZone);
		}
	}
}